
<%@ page import="java.io.File" %>
<%
      request.setCharacterEncoding("gb2312");
      String filePath=request.getParameter("filePath");
      
	if (filePath!=null){
		//int n=filePath.lastIndexOf("/")-1;
		filePath=filePath.substring(6);
		System.out.println("filePath is not null");
		System.out.println(filePath);
		String realPath=this.getServletContext().getRealPath(filePath);
		if(realPath!=null)
		{
			File imagfile=new File(realPath);
			System.out.println("realPath is not null");
			System.out.println(realPath);
			//System.out.println(imagfile);
			if(imagfile.exists()){
				imagfile.delete();
				out.println("<script>alert('success');</script>");
			}
		}
		else
			System.out.println("realPath is null");
		
	}else{
		System.out.println("filePath is empty!");
		out.println("<script>alert('delete error');</script>");
}
			out.clear();
			//out.close();
%>
